package com.wms.entity;


import com.baomidou.mybatisplus.annotation.TableField;
import com.wms.entity.enums.ResourceTypeEnum;
import lombok.Getter;
import lombok.Setter;

import java.util.List;

@Setter
@Getter
public class Resource extends BaseEntity {

    /**
     * 名称
     */
    private String name;

    /**
     * 类型
     */
    private ResourceTypeEnum type;

    /**
     * 页面
     */
    private String page;

    /**
     * 图标
     */
    private String icon;

    /**
     * 排序
     */
    private Integer orders;

    /**
     * 父类id
     */
    private Long parentId;


    @TableField(exist = false)
    private boolean checked = false;

    /**
     * 子类
     */
    @TableField(exist = false)
    private List<Resource> children;

    public String getTypeName() {
        return this.type == null ? null:this.type.getDesc();
    }

    public String getTitle(){
        return this.name;
    }

}
